<?php

/**
 * This is the model class for table "flujo".
 *
 * The followings are the available columns in table 'flujo':
 * @property integer $Id
 * @property string $Fecha
 * @property integer $CARRIER_Id
 * @property integer $DESTINATION_Id
 * @property integer $Tipo
 * @property integer $Minutes
 * @property integer $ACD
 * @property integer $ASR
 * @property integer $MarginPercent
 * @property integer $MarginPerMin
 * @property integer $CostPerMin
 * @property integer $RevenuePerMin
 * @property integer $PDD
 * @property integer $IncompleteCalls
 * @property integer $IncompleteCallsNER
 * @property integer $CompleteCallsNER
 * @property integer $CompleteCalls
 * @property integer $CallAttempts
 * @property integer $DurationReal
 * @property integer $DurationCost
 * @property integer $NER02Efficient
 * @property integer $NER02Seizure
 * @property integer $PDDCalls
 * @property integer $Revenue
 * @property integer $Cost
 * @property integer $Margin
 *
 * The followings are the available model relations:
 * @property Carrier $cARRIER
 * @property Destination $dESTINATION
 */
class Flujo extends CActiveRecord
{
	/**
	 * Returns the static model of the specified AR class.
	 * @param string $className active record class name.
	 * @return Flujo the static model class
	 */
	public static function model($className=__CLASS__)
	{
		return parent::model($className);
	}

	/**
	 * @return string the associated database table name
	 */
	public function tableName()
	{
		return 'flujo';
	}

	/**
	 * @return array validation rules for model attributes.
	 */
	public function rules()
	{
		// NOTE: you should only define rules for those attributes that
		// will receive user inputs.
		return array(
			array('Fecha, CARRIER_Id, DESTINATION_Id, Tipo, Minutes, ACD, ASR, MarginPercent, MarginPerMin, CostPerMin, RevenuePerMin, PDD, IncompleteCalls, IncompleteCallsNER, CompleteCallsNER, CompleteCalls, CallAttempts, DurationReal, DurationCost, NER02Efficient, NER02Seizure, PDDCalls, Revenue, Cost, Margin', 'required'),
			array('CARRIER_Id, DESTINATION_Id, Tipo, Minutes, ACD, ASR, MarginPercent, MarginPerMin, CostPerMin, RevenuePerMin, PDD, IncompleteCalls, IncompleteCallsNER, CompleteCallsNER, CompleteCalls, CallAttempts, DurationReal, DurationCost, NER02Efficient, NER02Seizure, PDDCalls, Revenue, Cost, Margin', 'numerical', 'integerOnly'=>true),
			// The following rule is used by search().
			// Please remove those attributes that should not be searched.
			array('Id, Fecha, CARRIER_Id, DESTINATION_Id, Tipo, Minutes, ACD, ASR, MarginPercent, MarginPerMin, CostPerMin, RevenuePerMin, PDD, IncompleteCalls, IncompleteCallsNER, CompleteCallsNER, CompleteCalls, CallAttempts, DurationReal, DurationCost, NER02Efficient, NER02Seizure, PDDCalls, Revenue, Cost, Margin', 'safe', 'on'=>'search'),
		);
	}

	/**
	 * @return array relational rules.
	 */
	public function relations()
	{
		// NOTE: you may need to adjust the relation name and the related
		// class name for the relations automatically generated below.
		return array(
			'cARRIER' => array(self::BELONGS_TO, 'Carrier', 'CARRIER_Id'),
			'dESTINATION' => array(self::BELONGS_TO, 'Destination', 'DESTINATION_Id'),
		);
	}

	/**
	 * @return array customized attribute labels (name=>label)
	 */
	public function attributeLabels()
	{
		return array(
			'Id' => 'ID',
			'Fecha' => 'Fecha',
			'CARRIER_Id' => 'Carrier',
			'DESTINATION_Id' => 'Destination',
			'Tipo' => 'Tipo',
			'Minutes' => 'Minutes',
			'ACD' => 'Acd',
			'ASR' => 'Asr',
			'MarginPercent' => 'Margin Percent',
			'MarginPerMin' => 'Margin Per Min',
			'CostPerMin' => 'Cost Per Min',
			'RevenuePerMin' => 'Revenue Per Min',
			'PDD' => 'Pdd',
			'IncompleteCalls' => 'Incomplete Calls',
			'IncompleteCallsNER' => 'Incomplete Calls Ner',
			'CompleteCallsNER' => 'Complete Calls Ner',
			'CompleteCalls' => 'Complete Calls',
			'CallAttempts' => 'Call Attempts',
			'DurationReal' => 'Duration Real',
			'DurationCost' => 'Duration Cost',
			'NER02Efficient' => 'Ner02 Efficient',
			'NER02Seizure' => 'Ner02 Seizure',
			'PDDCalls' => 'Pddcalls',
			'Revenue' => 'Revenue',
			'Cost' => 'Cost',
			'Margin' => 'Margin',
		);
	}

	/**
	 * Retrieves a list of models based on the current search/filter conditions.
	 * @return CActiveDataProvider the data provider that can return the models based on the search/filter conditions.
	 */
	public function search()
	{
		// Warning: Please modify the following code to remove attributes that
		// should not be searched.

		$criteria=new CDbCriteria;

		$criteria->compare('Id',$this->Id);
		$criteria->compare('Fecha',$this->Fecha,true);
		$criteria->compare('CARRIER_Id',$this->CARRIER_Id);
		$criteria->compare('DESTINATION_Id',$this->DESTINATION_Id);
		$criteria->compare('Tipo',$this->Tipo);
		$criteria->compare('Minutes',$this->Minutes);
		$criteria->compare('ACD',$this->ACD);
		$criteria->compare('ASR',$this->ASR);
		$criteria->compare('MarginPercent',$this->MarginPercent);
		$criteria->compare('MarginPerMin',$this->MarginPerMin);
		$criteria->compare('CostPerMin',$this->CostPerMin);
		$criteria->compare('RevenuePerMin',$this->RevenuePerMin);
		$criteria->compare('PDD',$this->PDD);
		$criteria->compare('IncompleteCalls',$this->IncompleteCalls);
		$criteria->compare('IncompleteCallsNER',$this->IncompleteCallsNER);
		$criteria->compare('CompleteCallsNER',$this->CompleteCallsNER);
		$criteria->compare('CompleteCalls',$this->CompleteCalls);
		$criteria->compare('CallAttempts',$this->CallAttempts);
		$criteria->compare('DurationReal',$this->DurationReal);
		$criteria->compare('DurationCost',$this->DurationCost);
		$criteria->compare('NER02Efficient',$this->NER02Efficient);
		$criteria->compare('NER02Seizure',$this->NER02Seizure);
		$criteria->compare('PDDCalls',$this->PDDCalls);
		$criteria->compare('Revenue',$this->Revenue);
		$criteria->compare('Cost',$this->Cost);
		$criteria->compare('Margin',$this->Margin);

		return new CActiveDataProvider($this, array(
			'criteria'=>$criteria,
		));
	}
}